package com.lagou.bak;

import org.apache.flink.streaming.api.functions.source.SourceFunction;

public class NoParalleSource implements SourceFunction<String> {
    private Long count = 1l;
    private boolean isRunning = true;

    public void run(SourceContext<String> ctx) throws Exception {
        while (isRunning) {
            count ++;
            ctx.collect(String.valueOf(count));
            Thread.sleep(1000);
        }
    }

    public void cancel() {
        isRunning = false;
    }
}
